import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/login' },
  { path: '/login', component: () => import('@/views/XmLogin.vue') },
  { path: '/register', component: () => import('@/views/XmRegister.vue') },
  {
    path: '/home',
    component: () => import('@/views/XmHome.vue'),
    redirect: '/home/article/recommend',
    children: [
      {
        path: 'article',
        component: () => import('@/views/XmArticle.vue'),
        redirect: '/home/article/recommend',
        children: [
          { path: 'recommend', component: () => import('@/views/XmRecommend.vue') },
          { path: 'new', component: () => import('@/views/XmNew.vue') }
        ]
      },
      { path: 'collect', component: () => import('@/views/XmCollect.vue') },
      { path: 'like', component: () => import('@/views/XmLike.vue') },
      { path: 'user', component: () => import('@/views/XmUser.vue') }
    ]
  },
  { path: '/details', component: () => import('@/views/XmDetails.vue') }
]

const router = new VueRouter({ routes })
export default router
